<?php
$cs = Yii::app()->getClientScript();
$baseUrl = Yii::app()->request->baseUrl;
$cs->registerCssFile($baseUrl . '/css/slide_view.css');
$cs->registerScriptFile($baseUrl . '/js/jquery/slides.min.jquery.js', CClientScript::POS_END);
?>
<div>
    <h2><?php echo $productDetail->name; ?></h2>
    <div id="_images" style="clear: both;">
        <div id="products_example">
            <div id="products">
                <div class="slides_container">
                    <?php foreach ($productImages as $productImage): ?>
                        <a href="javascript:void(0)"><img src="<?php echo $productImage->path; ?>" style="max-width:400px !important; max-height:450px !important;" alt="#"/></a>              
                    <?php endforeach; ?>
                </div>
                <ul class="pagination">
                    <?php foreach ($productImages as $productImage): ?>
                        <li><a href="javascript:void(0)"><img src="<?php echo $productImage->path; ?>" style="max-width:60px !important; max-height:60px !important;" alt="#"/></a></li>
                    <?php endforeach; ?>
                </ul>
            </div>    
        </div>
    </div>
    <div id="_content" class="product-content-detail">
        <!--<table border="1" cellpadding="1" cellspacing="1" height="78" width="110">
            <tbody>
                <tr>
                    <td><b>Nhà sản xuất:</b></td>
                    <td>
                    <?php //$producer = Producer::model()->findByPk($product->producer_id); 
                    //echo $producer->name;
                    echo $product->producer->name;
                    ?>
                    </td>
                </tr>
                <tr>
                    <td><b>Giá:</b></td>
                    <td> <?php echo $product->price ?></td>
                </tr>
                <tr>
                    <td><b>Tình trạng:</b></td>
                    <td>
                        <?php
                        if ($product->state == 1) {
                            echo 'Còn hàng';
                        } else {
                            echo 'Hết hàng';
                        }
                        ?>
                    </td>
                </tr>
            </tbody>
        </table>-->
        <div>
            <p>
                <?php echo $productDetail->content; ?>
            </p>
        </div>
        <div>
            <?php $btn_cart = 'btn_' . $product->id; ?>
            <a productId="<?php echo $product->id ?>" productName="<?php echo $productDetail->name; ?>" productPrice="<?php echo $product->price; ?>" productPromotion="<?php echo $product->promotion; ?>" id="<?php echo $btn_cart ?>" class="btn btn-warning add_to_cart_btn btn_add_cart" href="#">
                Thêm vào giỏ hàng
            </a>
        </div>
    </div>
</div>
<script type="text/javascript">
    jQuery(function(){
        jQuery('#products').slides({
            preload: true,
            preloadImage: 'css/img/loading.gif',
            effect: 'slide, fade',
            crossfade: true,
            slideSpeed: 350,
            fadeSpeed: 400,
            generateNextPrev: true,
            generatePagination: false
        });
    });
</script>